﻿using Google.GData.Client;
using System;
using System.Security.Principal;
using System.Threading;

namespace Desktop.Library
{
    public class GoogleIdentity : IIdentity
    {
        #region Constructors

        /// <summary>
        /// Get an unauthenticated identity.
        /// </summary>
        /// <returns></returns>
        public GoogleIdentity()
        {
            Name = "not logged in";
            IsAuthenticated = false;
        }

        public GoogleIdentity(string username, string password)
        {
            Name = username;
            IsAuthenticated = false;
            Credentials = new GDataCredentials(username, password);
            if (Credentials != null)
            {
                IsAuthenticated = true;
            }
        }

        #endregion

        #region Properties

        public string AuthenticationType
        {
            get
            {
                return "Google";
            }
        }

        public bool IsAuthenticated { get; private set; }

        public string Name { get; private set; }

        public GDataCredentials Credentials { get; private set; }

        #endregion
    }
}
